package AsLayers.Tile
{
	import AsLayers.BaseType.*;
	import AsLayers.Layer.ILayer;
	public class Base implements ITile
	{

		public var position:Pixel
		public var bounds:Bounds
		public var size:Size
	    public var  drawn: Boolean=false
        public var layer:ILayer
        public var isLoading: Boolean=false
        public var queued:Boolean=false
		public function Base( position:Pixel, bounds:Bounds, size:Size){
			  this.position = position;
              this.bounds = bounds;
              this.size = size;
			
		}
        public function getBounds():Bounds{
        	return this.bounds;
        }
        public function destroy():void{
        	           	this.position = null;
            this.bounds = null;
            this.size = null;
        }
		public function setLayer(layer:ILayer):void{
             this.layer=layer;
		}
		public function clear():void {
             this.drawn = false;
             this.isLoading=false;
             this.queued=false;
        }
        public  function draw():void{

	    }
	    public function getPosition():Pixel{
	    	return this.position;
	    }
	    public function isDrawed():Boolean{
	    	return this.drawn;
	    }
	    public	function isQueued():Boolean{
	    	return this.queued;
	    }
		public function setQueued(q:Boolean):void{
			this.queued=q;
		}
		public function moveTo(bounds:Bounds, position:Pixel, redraw:Boolean):void{
            this.clear();
            this.bounds = bounds.clone();
            this.position = position.clone();
            if (redraw) {
               this.draw();
            }
		}
		
	}
}